/* This script and many more are available free online at
The JavaScript Source!! http://javascript.internet.com
Created by: Jim Stiles | www.jdstiles.com */
function startCalc(){
  interval = setInterval("calc()",1);
}
function calc(){
  one = document.autoSumForm.field18.value;
  two = document.autoSumForm.field2.value; 
  three = document.autoSumForm.field3.value;
  four = document.autoSumForm.field4.value;
  five = document.autoSumForm.field5.value;
  six = document.autoSumForm.field6.value;
  seven = document.autoSumForm.field7.value;
  eight = document.autoSumForm.field8.value;
  nine = document.autoSumForm.field9.value;
  ten = document.autoSumForm.field10.value;
  eleven = document.autoSumForm.field11.value;
  twelve = document.autoSumForm.field12.value;
  thirteen = document.autoSumForm.field13.value;
  fourteen = document.autoSumForm.field14.value;
  fifteen = document.autoSumForm.field15.value;
  sixteen = document.autoSumForm.field16.value;

  document.autoSumForm.field16.value = roundNumber((one * 1) + (two * 1) + (three * 1) + (four * 1) + (five * 1) + (six * 1) + (seven * 1) + (eight * 1) + (nine * 1) + (ten * 1) + (eleven * 1) + (twelve * 1) + (thirteen * 1) + (fourteen * 1) + (fifteen * 1),2);
  document.autoSumForm.field38.value = (sixteen * 1);
  
  nineteen = document.autoSumForm.field19.value;
  twenty = document.autoSumForm.field20.value; 
  twentyone = document.autoSumForm.field21.value;
  twentytwo = document.autoSumForm.field22.value;
  twentythree = document.autoSumForm.field23.value;
  twentyfour = document.autoSumForm.field24.value;
  twentyfive = document.autoSumForm.field25.value;
  twentysix = document.autoSumForm.field26.value;
  twentyseven = document.autoSumForm.field27.value;
  twentyeight = document.autoSumForm.field28.value;
  twentynine = document.autoSumForm.field29.value;
  thirty = document.autoSumForm.field30.value;
  thirtyone = document.autoSumForm.field31.value;
  thirtytwo = document.autoSumForm.field32.value;
  thirtythree = document.autoSumForm.field33.value;
  thirtyfour = document.autoSumForm.field34.value;
  thirtyfive = document.autoSumForm.field35.value;
  thirtysix = document.autoSumForm.field36.value;
  seventeen = document.autoSumForm.field37.value;
  document.autoSumForm.field37.value = roundNumber((nineteen * 1) + (twenty * 1) + (twentyone * 1) + (twentytwo * 1) + (twentythree * 1) + (twentyfour * 1) + (twentyfive * 1) + (twentysix * 1) + (twentyseven * 1) + (twentyeight * 1) + (twentynine * 1) + (thirty * 1) + (thirtyone * 1) + (thirtytwo * 1) + (thirtythree * 1) + (thirtyfour * 1) + (thirtyfive * 1) + (thirtysix * 1),2);
  document.autoSumForm.field39.value = (seventeen * 1);
  thirtyeight = document.autoSumForm.field38.value;
  thirtynine = document.autoSumForm.field39.value;
  document.autoSumForm.field40.value = roundNumber((thirtyeight * 1) - (thirtynine * 1),2);
}
function stopCalc(){
  clearInterval(interval);
}

function startCalc1(){
  interval = setInterval("calc1()",1);
}
function calc1(){
  one = document.autoSumForm.textfield1.value;
  two = document.autoSumForm.textfield2.value;
  three = document.autoSumForm.textfield3.value; 
  four = document.autoSumForm.textfield4.value;
  five = document.autoSumForm.textfield5.value;
  six = document.autoSumForm.textfield6.value;
  seven = document.autoSumForm.textfield7.value;
  eight = document.autoSumForm.textfield8.value;
  nine = document.autoSumForm.textfield9.value;
  ten = document.autoSumForm.textfield10.value;
  eleven = document.autoSumForm.textfield11.value;
  twelve = document.autoSumForm.textfield12.value;
  thirteen = document.autoSumForm.textfield13.value;
 
  document.autoSumForm.textfield12.value = roundNumber((two * 1) + (three * 1) + (four * 1) + (five * 1) + (six * 1) + (seven * 1) + (eight * 1) + (nine * 1) + (ten * 1) + (eleven * 1),2);

  document.autoSumForm.textfield13.value = roundNumber((twelve * 1) - (one * 1),2);
}
function stopCalc1(){
  clearInterval(interval);
}

function roundNumber(num, dec) {
	var result = Math.round(num*Math.pow(10,dec))/Math.pow(10,dec);
	return result;
}